import request from '@/utils/request'

export function login(data) {
  return request({
    // url: '/vue-element-admin/user/login',
    // method: 'post',
    // data
    // url: 'https://api.dev.iotzhihe.com/login',
    url: 'http://60.205.182.149/login',
    method: 'post',
    headers:{'content-Type': 'application/x-www-form-urlencoded'},
    data
  })
}

export function getInfo(userId) {
  return request({
    url: 'http://60.205.182.149/api/security/user/user-profile',
    // url: 'http://192.168.1.4:9527/vue-element-admin/user/info',
    method: 'get',
    params: { userId }
  })
}

export function logout() {
  return request({
    url: '/vue-element-admin/user/logout',
    method: 'post'
  })
}

export function getUser(tenantId) {
  return request({
    url: '/api/security/user',
    method: 'get',
    params: { tenantId }
  })
}

export function postUser(data) {
  return request({
    url: '/api/security/user',
    method: 'post',
    data
  })
}

export function deleteCompany(userId) {
  return request({
    url: `/api/security/user/${userId}`,
    method: 'delete'
  })
}

export function getUserId(userId) {
  return request({
    url: `/api/security/user/${userId}?userId=${userId}`,
    method: 'get'
  })
}

export function putCompany(userId,data) {
  return request({
    url: `/api/security/user/${userId}`,
    method: 'put',
    data
  })
}

export function getCompany(userId) {
  return request({
    url: `/api/security/user/user-profile?userId=${userId}`,
    method: 'get'
  })
}



export function category() {
  return request({
    url: '/api/goods/category', 
    method: 'get'
  })
}

export function permission() {
  return request({
    url: '/api/security/permission', 
    method: 'get'
  })
}